package com.springboot.springboot_demo02.dao;

import com.springboot.springboot_demo02.pojo.Article;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface ArticleDao {
    @Select("select * from t_article")
    List<Article> findAll();
    @Select("select * from t_article where id =#{id}")
    List<Article> findById(Integer id);
    @Update("update t_article set title=#{title},content=#{content} where id =#{id}")
    int update(Article article);
    @Delete("delete from t_article where id=#{id}")
    int delete(Integer id);
    @Insert("insert into t_article(title,content) values(#{title},#{content})")
    int save(Article article);

}
